<?php

/**
 * Publication form.
 *
 * @package    academia_de_escritores
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class PublicationForm extends BasePublicationForm
{
  public function configure()
  {
  	
  	unset($this["created_at"], $this["updated_at"],$this["students_qty"] );
  	$date_options = array('format'=>'%day%/%month%/%year%');
  	$this->widgetSchema["start_date"]= new sfWidgetFormJQueryDate(array('culture' => 'es',
												'config' => '{firstDay: 0}',
												'date_widget' => new sfWidgetFormDate(array('format' => '%day%/%month%/%year%'))
	));
	
	$this->widgetSchema["end_date"]= new sfWidgetFormJQueryDate(array('culture' => 'es',
												'config' => '{firstDay: 0}',
												'date_widget' => new sfWidgetFormDate(array('format' => '%day%/%month%/%year%'))
	));
    $this->widgetSchema["teachers_list"] = new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'Teacher',"renderer_class" => "sfWidgetFormSelectDoubleList"));
	
    $this->getWidgetSchema()->setLabels(
  		array("is_active"=>"Activo",
  			  "allow_inscription"=>"Permitir inscripción",
  			  "course_id"=>"Curso",
  			  "start_date"=>"Fecha de inicio",
  			  "end_date"=>"Fecha de finalización",
  			  "price"=>"Precio",
  			  "teachers_list"=>"Profesores"
  			));
    if(!$this->isNew()){
    	$this->getWidget("price")->setAttribute("readonly", "readonly");
    	$this->getWidgetSchema()->setHelp("price","Este precio no es editable");
    }
    $this->useFields(array("course_id","is_active","allow_inscription","start_date","end_date","price","teachers_list"));
   
  }
}
